package com.lottery.game.controller.v2.pay.requestVO;

import com.lottery.game.common.exception.BaseException;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;

/**
 * @Description
 * @Classname FindPasswordTO
 * @Date 2019/4/25 13:40
 * @Author liusc <liushicheng1993@vip.qq.com>
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "找回密码实体")
public class FindPayPasswordVO {

    @NotEmpty(message = "密码不能为空")
    @ApiModelProperty(required = true, name = "password", notes = "密码",example = "12345678")
    @Length(min = 6, max = 16, message="密码必须是6位数字")
    private String password;

    @NotEmpty(message = "确认密码不能为空")
    @ApiModelProperty(required = true, name = "rePassword", notes = "确认密码",example = "12345678")
    @Length(min = 6, max = 16, message="密码必须是6位数字")
    private String rePassword;

    @NotEmpty(message = "接受短信验证码手机号不能为空")
    @ApiModelProperty(name = "phone", value = "短信验证手机号", required = true,example = "15348304228")
    private String phone;

    public void validate() {
        if (!password.equals(rePassword)) {
            throw new BaseException("两次登陆密码不一致");
        }
    }
}
